﻿using System.Threading.Tasks;

namespace LabNet.Server.Data
{
    public class UnitOfWork : IUnitOfWork
    {
         protected IDataContext Context;
        

        public IDataContext DataContext
        {
            get { return Context ?? (Context = new DefaultContext()); }
        }

        public virtual int Commit()
        {
            var result = DataContext.Commit();
            return result;
        }

        public virtual async Task<int> CommitAsync()
        {
            var result = await DataContext.CommitAsync();
            return result;
        } 
    }
}
